package cn.hg.test.listener;

import com.jfinal.plugin.IPlugin;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;

import cn.hg.jboot.core.directive.LikeParaDirective;
import io.jboot.aop.jfinal.JfinalPlugins;
import io.jboot.core.listener.JbootAppListenerBase;

/**
 * @author 胡高
 * @date 2022/04/13
 */
public class LikeTestAppListener extends JbootAppListenerBase{
    @Override
    public void onPluginConfig(JfinalPlugins plugins) {
        for (IPlugin  plugin : plugins.getPluginList()) {
            if (plugin instanceof ActiveRecordPlugin) {
                ActiveRecordPlugin arp = (ActiveRecordPlugin) plugin;

                /*
                 * 自定义的SQL模板引擎指令
                 */
                arp.getEngine().addDirective(LikeParaDirective.DIRECTIVE_NAME, LikeParaDirective.class);
            }
        }
    }
}
